<?php
header ( 'P3P:CP=CAO PSA OUR' );
define ( "DEBUG", true );
// Report all errors directly to the screen for simple diagnostics in the dev environment
error_reporting ( E_ALL ^ E_NOTICE );
ini_set ( 'display_startup_errors', 1 );
ini_set ( 'display_errors', 1 );
ini_set ( 'magic_quotes_runtime', 0 );
ini_set ( "session.cookie_httponly", 1 );
/* 服务器域名地址 */
$server = $_SERVER [''];
define ( "COOKIEDOMAIN", $_SERVER ['SERVER_NAME'] );
define ( "PUBLICWEBROOT", 'http://' . $_SERVER ['SERVER_NAME'] . "/" );
define ( "HOMEURL", 'http://' . $_SERVER ["HTTP_HOST"] . '/' );
// 游戏名
define ( "TITLE", "雄霸乾坤" );

// 服务器编号
define ( "GAMESERVER_NUM", "S1" );

// TICKET
define ( "TICKET_SUBFIX", "THISIS407FAIRYTASK" );

// MD5KEY
define ( "MD5KEY", "vXDKCbm*dwZb+D+*JhMXU%+o" );

// 游戏程序网关IP
// define("GAME_IP", $_SERVER["HTTP_HOST"]);
define ( "GAME_IP", "192.168.1.220" );

// 游戏程序网关对外开放端口
define ( "GAME_PORT", 8777 );

// 收藏夹名称 为空则为当前浏览器标题
define ( "FAVOURITENAME", "" );
// 收藏链 为空则当前浏览器地址
define ( "FAVOURITEURL", "" );

// 兑换率
define ( "SERVER_RATE", 10 );

// 允许做支付操作的IP地址
$ips_AllowPay = array (
		"127.0.0.1" 
);

// 对使用smarty cache 的地方是否开启缓存
define ( "USE_SMARTY_CACHE", 0 );

// 允许的服务器序号列表
$SN_ALLOW = array (
		1,
		2 
);

/**
 * **session***
 */
session_start ();
header ( 'Content-Type: text/html; charset=utf-8' ); // 字符集
date_default_timezone_set ( "Asia/Shanghai" ); // 时区
// 根路径
define ( 'ROOT_DIR', dirname ( __FILE__ ) ."/" );
// 库路径，将设置为 include path
define ( 'LIB_DIR', ROOT_DIR . 'lib/' );
// 日志
define ( 'LOG_DIR', ROOT_DIR . 'log/' );
// 游戏数据缓冲目录
define ( 'CACHE_DIR', ROOT_DIR . 'cache/' );
// 配置文件目录
define ( 'CONFIG_DIR', ROOT_DIR . 'config/' );

set_include_path (PATH_SEPARATOR . ROOT_DIR . 'lib');

include ROOT_DIR . 'lib/Helper/String.php';

// 通知刷新基础数据
function refresh_erlang_data($type) {
	$url = 'http://' . GAME_IP . ':' . GAME_PORT . '/load_base_data?' . $type;
	$ch = curl_init ();
	curl_setopt ( $ch, CURLOPT_URL, $url );
	curl_setopt ( $ch, CURLOPT_RETURNTRANSFER, 1 );
	curl_setopt ( $ch, CURLOPT_CONNECTTIMEOUT, 10 );
	$ret = curl_exec ( $ch );
	curl_close ( $ch );
	return $ret;
}
